This is a new script for Sept 2021 to treat both Dali and Pippa data at the same time, and to consider 3 periods of work.

Detailed schedule for the two monkeys can be found in Training history.docx, but here we consider 3 periods of the Switch Task: ST1 – from the start of Switch Task just after transfer - criterion learning... ST2 – from when they learn without criterion to surgery ST3 – later period with stable recordings and well after surgery (P& D only)

Previous scripts cover only ST3 (for example teh first Domenech_Analysis)

Data are loaded from pre-prepared data files, see the silenced chunks for loading of new data or parameters.

First load the major datafile

What is in each session?

## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

Let's build a trial by trial matrix to help the trial analysis, and populate it with the necessary information on each trial and TS

Use this to produce a monkey version of the figures from PD's AI manuscript

## 
## Attaching package: 'doBy'
## The following object is masked from 'package:dplyr':
## 
##     order_by

Performance of the 2 monkeys across the 3 stages of this task is fairly similar and strong. The monkeys look very much like the "good learner" humans in the PD manuscript, without the AI lesion There is possibly a reduction in the trap reactivity across phases, so will study this below.

So how does the monkeys' within-TS learning change across the stages?

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

The comparison here is tricky as there is a criterion in ST1 but not afterwards. Maybe learning is initially faster in later STs? But overall there is a wider spread and more bad TSs in the later STs

Now we want to reproduce some of the figures from Faraut et al 2016, but for the current dataset

So in the early version the Trap reactivity is greater than it is more recently, but there are pre-trap differences between the monkeys so interpretation is hard. To be discussed....

So can we track a trap reactivity measure across the stages?

## `summarise()` regrouping output by 'monkey', 'Phase', 'session' (override with `.groups` argument)
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

The evidence for a diminishing trap reactivity over time is present but weak...

So what else can we add to this?